package cn.bobohost.crmrbac.config;

import cn.bobohost.crmrbac.web.interceptor.CheckLoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author jy
 * @version 1.0
 * @date 2022/2/13 23:15
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

    @Autowired
    private CheckLoginInterceptor checkLoginInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        /**
         * 放行的资源
         */
//        String[] excludePath = {"/css/**","/img/**","/js/**","/login.html","/user/**"};
//        registry.addInterceptor(checkLoginInterceptor)
//                .addPathPatterns("/**")  //拦截哪些请求路径，这里拦截所有
//                .excludePathPatterns(excludePath);  //排除哪些不拦截，放行效果


//        registry.addInterceptor(checkPermissionInterceptor)
//                .addPathPatterns("/**")
//                .excludePathPatterns(excludePath);
    }
}
